package com.haoshuang.zhouzhoubang.ui.dialog

import android.content.Context


import android.widget.TextView
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.haoshuang.zhouzhoubang.R
import com.haoshuang.zhouzhoubang.model.bean.BjBean
import com.haoshuang.zhouzhoubang.ui.adapter.TkAdapter2
import com.lxj.xpopup.core.BottomPopupView



class BjDialog2(context: Context, list2:ArrayList<BjBean>, private val onSubmit: (str:BjBean) -> Unit) : BottomPopupView(context){
    override fun getImplLayoutId(): Int = R.layout.dialog_list
    var list=list2
    var context2=context
    override fun initPopupContent() {
        super.initPopupContent()

        var adapter= TkAdapter2(list)
        var tvGb2=findViewById<TextView>(R.id.gb)
        var rvList=findViewById<RecyclerView>(R.id.rvList)
        rvList.layoutManager=LinearLayoutManager(context2)
        rvList.adapter=adapter
        adapter.setOnItemClickListener { adapter, view, position ->
            dismiss()
            onSubmit(list[position])
        }
        tvGb2.setOnClickListener {
            dismiss()
        }

    }


}